/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package scm.rawMaterialPurchasing.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;

/**
 *
 * @author ReinforceII
 */
@Entity
public class RawMaterialPurchasingOrderEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    @OneToMany(cascade = {CascadeType.ALL})
    private List<RawMaterialPurchasingOrderLineItemEntity> rawMaterialPurchasingOrderLineItems;
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dateGenerated;
    
    @ManyToOne
    private SupplierEntity supplier;

    private double totalPrice;
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RawMaterialPurchasingOrderEntity)) {
            return false;
        }
        RawMaterialPurchasingOrderEntity other = (RawMaterialPurchasingOrderEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "scm.rawMaterialPurchasing.entity.RawMaterialPurchasingOrderEntity[ id=" + id + " ]";
    }

    /**
     * @return the rawMaterial


    /**
     * @return the dateGenerated
     */
    public Date getDateGenerated() {
        return dateGenerated;
    }

    /**
     * @param dateGenerated the dateGenerated to set
     */
    public void setDateGenerated(Date dateGenerated) {
        this.dateGenerated = dateGenerated;
    }

    /**
     * @return the supplier
     */
    public SupplierEntity getSupplier() {
        return supplier;
    }

    /**
     * @param supplier the supplier to set
     */
    public void setSupplier(SupplierEntity supplier) {
        this.supplier = supplier;
    }

    /**
     * @return the rawMaterialPurchasingOrderLineItems
     */
    public List<RawMaterialPurchasingOrderLineItemEntity> getRawMaterialPurchasingOrderLineItems() {
        return rawMaterialPurchasingOrderLineItems;
    }

    /**
     * @param rawMaterialPurchasingOrderLineItems the rawMaterialPurchasingOrderLineItems to set
     */
    public void setRawMaterialPurchasingOrderLineItems(List<RawMaterialPurchasingOrderLineItemEntity> rawMaterialPurchasingOrderLineItems) {
        this.rawMaterialPurchasingOrderLineItems = rawMaterialPurchasingOrderLineItems;
    }

    /**
     * @return the totalPrice
     */
    public double getTotalPrice() {
        return totalPrice;
    }

    /**
     * @param totalPrice the totalPrice to set
     */
    public void setTotalPrice(double totalPrice) {
        this.totalPrice = totalPrice;
    }
    
}
